﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DrugStore.Exceptions;

namespace DrugStore.Models
{
    public class MangeNewCategoryModel
    {
    }

    public class NewCategoryBusiness 
    {
        public Guid SelectCategoryId() 
        {
            DrugStoreEntities entities = new DrugStoreEntities();
            Category category = (Category)entities.Categories.FirstOrDefault();
            if (category == null) 
            {
                throw new Exception("Bạn chưa tạo danh mục tin !");
            }

            return category.CategoryId;
        }

        public List<Category> SelectCategories() 
        {
            DrugStoreEntities entities = new DrugStoreEntities();
            return entities.Categories.ToList();
        }
    }
}